package com.kunbo.cn.dao.system.user;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.kunbo.cn.entity.system.user.User;

public interface UserDao extends JpaRepository<User,Integer>{
	User findByNameAndPassword(String name, String password);
	User findById(int id);
	
	@Query("from User where position_id=?1")
	List<User> findByPositionId(int position_id);
	
	@Query("from User where name= ?1 and password= ?2")
	User check(String name,String password);
	
	@Query("from User where activiti_uuid= ?1 ")
	User findByActivitiUUID(String activiti_uuid);
	
	User findByName(String name);
	
	@Query( value = "from User", countQuery = "select count(*) from User" )  
	Page<User> page(Pageable pageable);
	
	@Query("from User where actual_name=?1")
	List<User> findByActual_name(String actual_name);
}
